const {
  formateTime
} = require("./utils");
const getOpenId = require('./getOpenId/index');
const getMiniProgramCode = require('./getMiniProgramCode/index');
const uploadPhoto = require("./uploadPhoto/index");
const queryStandPhoto = require("./queryStandPhoto/index");
const delStandPhoto = require("./delStandPhoto/index");
const queryDictList = require("./queryDictList/index");
const addOrder = require("./addOrder/index");
const getOrderDetail = require("./getOrderDetail/index");
const getOrderList = require("./getOrderList/index");
const getPhone = require("./getPhone/index");
const getUser = require("./getUser/index");
const getAllOrderList = require("./getAllOrderList");
const successOrder = require("./successOrder/index");
const addAdmin = require("./addAdmin/index");
// 云函数入口函数
exports.main = async (event, context) => {
  const timeNow = await formateTime.formatTime(); //创建时间
  const dbTime = new Date(Date.now()); //数据库时间
  event["inTime"] = timeNow;
  event["dbTime"] = dbTime;
  switch (event.type) {
    case 'getOpenId':
      return await getOpenId.main(event, context);
    case 'getMiniProgramCode':
      return await getMiniProgramCode.main(event, context);
    case "uploadPhoto":
      return await uploadPhoto.main(event, context);
    case "queryStandPhoto":
      return await queryStandPhoto.main(event, context);
    case "delStandPhoto":
      return await delStandPhoto.main(event, context);
    case "queryDictList":
      return await queryDictList.main(event, context);
    case "addOrder":
      return await addOrder.main(event, context);
    case "getOrderDetail":
      return await getOrderDetail.main(event, context);
    case "getOrderList":
      return await getOrderList.main(event, context);
    case "getPhone":
      return await getPhone.main(event, context);
    case "getUser":
      return await getUser.main(event,context);
    case "getAllOrderList":
      return await getAllOrderList.main(event,context);
    case "successOrder":
      return await successOrder.main(event,context);
    case "addAdmin":
      return await addAdmin.main(event,context);
  }
};